package com.allqj.sfx.ddd.member.infrastructure.dao;

import com.allqj.sfx.ddd.member.infrastructure.po.FlowTaskDefDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author sjw
 * @className FlowTaskDefDAO
 * @date 2022/7/21 9:32
 * @description: 数据访问层
 */
public interface FlowTaskDefDAO extends JpaRepository<FlowTaskDefDO, Integer>, JpaSpecificationExecutor<FlowTaskDefDO> {
    @Transactional
    @Modifying
    @Query(value = "update FlowTaskDefDO set isdelete=1 where flowDefId=?1")
    Integer deleteByFlowDefId(Integer flowDefId);

    List<FlowTaskDefDO> findAllByFlowDefIdAndIsdeleteFalse(Integer flowDefId);
}
